//缓存数据
var App = {
  appId: 146,
  //url: "http://192.168.6.100:3000/new/三和代码/sanhe/data/"
  url: "http://47.106.146.13:806/api"
}

var store = {
    save : function(name,value){
      localStorage.setItem(name,JSON.stringify(value));
    },
    fetch:function(value){
      return JSON.parse(localStorage.getItem(value)) || [];
    },
    remove : function(name){
        localStorage.removeItem(name);
    },
    clear : function(){
         localStorage.clear();
    }
}


function reAjax( rData ,fn){
    rData.Time = new Date().toISOString();
    rData.AppId  = App.appId;
   var def = $.ajax({
         url: App.url,
         type:'post',
         beforeSend: function(jqXHR, settings){
            jqXHR.setRequestHeader("Content-Type","Json");
         },
         data:JSON.stringify( rData),
         success: function (result) {
             if (typeof result == "string") {
                 result = JSON.parse(result);
             }
            
             fn && fn(result);
         }
     });
     return def;
}